package WaiBao;

import java.util.Arrays;

public class LiuJingSheng {
    public static void main(String[] args) {
        String[] name = {"刘桂兰(班长)", "李芳芳(副班长)", "小李(学习委员)", "张晓晓(体育委员)", "马兰", "刘波兰", "李兰花", "催兰花", "宋晓鹏", "宋结盟", "李菲菲", "王朗",
                "听安", "枷锁", "北慕", "憨憨", "小锦儿", "故事", "韩氏", "嗨氏", "启明", "赖神", "吕德华", "张大仙", "剑仙", "裴小峰", "韩跑跑", "张跳跳",
                "张小虎", "刘金盛(学生)"};//考生本人:刘金盛(学生)
        int[] age = {21, 18, 19, 20, 19, 21, 18, 21, 18, 20, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 20, 21, 20, 20};//考生年龄：20


        double[] taote1 = {75, 72, 85, 80, 80, 69, 78, 80, 81, 74, 91, 87, 85, 79, 68, 68, 69, 69, 96, 88, 92, 91, 95, 85, 75, 74, 77, 84, 91, 94};
        double[] taote2 = {76, 75, 89, 86, 78, 71, 85, 59, 65, 80, 90, 67, 66, 75, 67, 65, 84, 89, 66, 78, 82, 71, 85, 87, 77, 84, 74, 65, 91, 95};
        double[] taote3 = {77, 80, 81, 75, 79, 99, 68, 89, 80, 60, 83, 87, 85, 65, 65, 68, 89, 67, 96, 93, 92, 81, 95, 85, 76, 84, 73, 81, 84, 95};

        double guan1;//代表每个学生的总分
        double guan2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            guan1 = taote1[i] +taote2[i] +taote3[i];
//            guan2 = (guan1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + guan1);
//            System.out.println(name[i] + "的平均分为:" +guan2);
//        }


        double song1 = 0, song2 = 0;
//        double[] arr = new double[30];
//        for (int i = 0; i < 30; i++) {
//            song1 = taote1[i] + taote2[i] + taote3[i];
//            song2  = (song1 * 1.0) / 3;
//            arr[i] = song2 ;
//        }
//
//        for (int i = 0; i < arr.length - 1; i++) {
//            for (int j = 0; j < arr.length - i - 1; j++) {
//                if (arr[j] < arr[j + 1]) {
//                    double tep = arr[j];
//                    arr[j] = arr[j + 1];
//                    arr[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(arr[i]);
//        }


        //
        double do1 = 0, do2 = 0,do3 = 0;//计算每门课的平均分
        double qu1 = 0, qu2 = 0,qu3 = 0;//计算每门课标准差
        double mugu1 = 0, mugu2 = 0,mugu3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < taote1.length; i++) {
            sum2+=taote1[i];
        }
        do1 = (sum2*1.0)/30;
        System.out.println("农业设施及环境调控的班级平均分为:"+do1);
        double Sum = 0;
        for (int i = 0; i < taote2.length; i++) {
            Sum+=taote2[i];
        }
        do2 = (Sum*1.0)/30;
        System.out.println("农业设施设计与建造的班级平均分为:"+do2);
        double sum = 0;
        for (int i = 0; i <taote3.length; i++) {
            sum+=taote3[i];
        }
        do3 = (sum*1.0)/30;
        System.out.println("园艺植物设施栽培学的班级平均分为:"+do3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i < taote1.length; i++) {
            c1+= (taote1[i] -do1)*(taote1[i] - do1);
        }
        qu1 = Math.sqrt(c1*1.0/30);
        System.out.println("农业设施及环境调控的班级标准差为:"+qu1);

        for (int i = 0; i < taote2.length; i++) {
            c2+= (taote2[i] -do2)*(taote2[i] - do2);
        }
        qu2 = Math.sqrt(c2*1.0/30);
        System.out.println("农业设施设计与建造的班级标准差为:"+qu2);

        for (int i = 0; i < taote3.length; i++) {
            c3+= (taote3[i] - do3)*(taote3[i] - do3);
        }
        qu3 = Math.sqrt(c3*1.0/30);
        System.out.println("园艺植物设施栽培学的班级标准差为:"+qu3);
//////
        Arrays.sort(taote1);
        Arrays.sort(taote2);
        Arrays.sort(taote3);
        mugu1 =( taote1[15]+taote1[14])*1.0/2;
        mugu2 =( taote2[15]+taote2[14])*1.0/2;
        mugu3 =(taote3[15]+taote3[14])*1.0/2;
        System.out.println("农业设施及环境调控的中位数为:"+mugu1);
        System.out.println("业设施设计与建造的中位数为:"+mugu2);
        System.out.println("园艺植物设施栽培学的中位数为:"+mugu3);
//



    }
}
